/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.mycompany.entidades;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Johnny
 */
@Entity
@Table(catalog = "celulares", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Gasto.findAll", query = "SELECT g FROM Gasto g"),
    @NamedQuery(name = "Gasto.findByIdgasto", query = "SELECT g FROM Gasto g WHERE g.idgasto = :idgasto"),
    @NamedQuery(name = "Gasto.findByFecha", query = "SELECT g FROM Gasto g WHERE g.fecha = :fecha"),
    @NamedQuery(name = "Gasto.findByHora", query = "SELECT g FROM Gasto g WHERE g.hora = :hora"),
    @NamedQuery(name = "Gasto.findByValor", query = "SELECT g FROM Gasto g WHERE g.valor = :valor")})
public class Gasto
  implements Serializable
{
  private static final long serialVersionUID = 1L;

  @Id
  @GeneratedValue(strategy=GenerationType.IDENTITY)
  @Basic(optional=false)
  @Column(nullable=false)
  private Integer idgasto;

  @Temporal(TemporalType.DATE)
  private Date fecha;

  @Column(length=45)
  private String hora;

  @Lob
  @Column(length=65535)
  private String concepto;

  @Column(precision=22)
  private Double valor;

  @JoinColumn(name="idUsuario", referencedColumnName="nick", nullable=false)
  @ManyToOne(optional=false)
  private Usuario idUsuario;

  public Gasto()
  {
  }

  public Gasto(Integer idgasto)
  {
    this.idgasto = idgasto;
  }

  public Integer getIdgasto() {
    return this.idgasto;
  }

  public void setIdgasto(Integer idgasto) {
    this.idgasto = idgasto;
  }

  public Date getFecha() {
    return this.fecha;
  }

  public void setFecha(Date fecha) {
    this.fecha = fecha;
  }

  public String getHora() {
    return this.hora;
  }

  public void setHora(String hora) {
    this.hora = hora;
  }

  public String getConcepto() {
    return this.concepto;
  }

  public void setConcepto(String concepto) {
    this.concepto = concepto;
  }

  public Double getValor() {
    return this.valor;
  }

  public void setValor(Double valor) {
    this.valor = valor;
  }

  public Usuario getIdUsuario() {
    return this.idUsuario;
  }

  public void setIdUsuario(Usuario idUsuario) {
    this.idUsuario = idUsuario;
  }

  public int hashCode()
  {
    int hash = 0;
    hash += (this.idgasto != null ? this.idgasto.hashCode() : 0);
    return hash;
  }

  public boolean equals(Object object)
  {
    if (!(object instanceof Gasto)) {
      return false;
    }
    Gasto other = (Gasto)object;
    if (((this.idgasto == null) && (other.idgasto != null)) || ((this.idgasto != null) && (!this.idgasto.equals(other.idgasto)))) {
      return false;
    }
    return true;
  }

  public String toString()
  {
    return "com.mycompany.entidades.Gasto[ idgasto=" + this.idgasto + " ]";
  }
}